<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
<title></title>
<%@ include file="/WEB-INF/component/commonCSS.jsp"%>
<!--[if lt IE 9]>
        <script src="lib/js/html5shiv.min.js"></script>
        <script src="lib/js/respond.min.js"></script>
    <![endif]-->
</head>
<body class="skin-blue sidebar-mini fixed skin-blue-light-frame">
	<section class="content-header">
		<h1>遴选配送企业</h1>
		<ol class="breadcrumb">
			<li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
			<li class="active"><a href="#">交易</a></li>
			<li class="active"><a href="#">配送关系</a></li>
			<li class="active"><a href="#">遴选配送企业</a></li>
		</ol>
	</section>
	<section class="content">
		<div class=" box box-success">
			<div class="box-body">
				<div class="input">
				
					<div class="textalign1">市：</div>
                    <div class="boxinput">
	                    <select class="textinput" id="fatherId"  name="fatherId"> 
	                     <option value="">请选择</option>
	                    <c:forEach items="${list }" var="lis">
	                    	<option value="${lis.area_id }">${lis.area_name }</option>
	                    </c:forEach>
	                    </select>
                    </div>
                    <div class="textalign1">地区名称：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="areaName" placeholder="地区名称" />
                    </div>
                    <div class="textalign1">地区编码：</div>
                    <div class="boxinput">
                        <input type="text" class="textinput" id="areaCode" placeholder="地区编码" />
                    </div>
                   <div class="textalign1" >
					<button id="selectArea" type="button" class="btn btn-success btn-sm" onclick="gridSerch()">查&nbsp;询</button>
				</div>
				</div>
			</div>
		</div>
		<table class="jqgrid" id="gridlist"></table>
		<div id="gridpage"></div>
	</section>
	<%@ include file="/WEB-INF/component/commonJS.jsp"%>
	<script type="text/javascript">
        $(function () {    
        	
        	//绑定回车
        	$('#areaName,#areaCode,#fatherId').bind('keydown', function(event) {
        	    if (event.keyCode == "13") {
        	        $('#selectArea').click();
        	    }
        	}); 
        	$("#areaName").focus();//加载页面光标在第一个查询框内
        	
            $("#gridlist").jqGrid({
                url: "${pageContext.request.contextPath}/baseDel/getSelectDelArea.html",
                mtype: "POST",
                contentType : 'application/json',
                datatype: "json",
                autowidth: true,
              //  height: 390,
                colNames: ['操作',
                           '地区编码',
                           '地区名称',
                           '地区完整名称'
                           ],
                colModel: [
                    { name: 'operate', width: 10, align: 'center',sortable: false,
                        formatter:function(val, opts, rowdata){
                            str = "<a href=\"${ctx}/baseDel/toSelectDel.html?areaCode=" + rowdata.area_id + "\"  style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -180px -100px' class='opIcon' title='遴选配送企业'></a>";
                            return str;
                            }
                    },
                    { name: 'area_id',key:true, width: 40, align: 'center' ,sortable: false},
                    { name: 'area_name', width: 60 , align: 'center',sortable: false},
                    { name: 'ar_fullname', width: 80, align: 'center',sortable: false }
                ],
                rowNum: 0,
                //rowList: [10, 20, 50, 100],
                rownumbers: true,
                //pager: "#gridpage",
                viewrecords: true,
                multiselect: false,
                caption: "地区列表",
                gridComplete: function(){
					//序号列宽度自适应（参数为jqgridID）
					 //autoRNWidth("gridlist");
					//数据只有一条时默认选中（参数为jqgridID）
					 selectByOneData("gridlist");
				 },
                jsonReader: {
                    repeatitems: false,
                    id: "ids"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
			$("#gridlist").jqGrid("setGridHeight",create());
        });
        
        //查询
        function gridSerch(pg) {
            var areaCode = $.trim($("#areaCode").val());
            var areaName = $.trim($("#areaName").val());
            var fatherId = $("#fatherId").val();
            $("#gridlist").jqGrid('setGridParam',{  
                datatype:'json',
                postData:{"areaCode":areaCode,
                        "areaName":areaName,
                        "fatherId":fatherId,
                        "status":1
                        },
                        page : pg
            }).trigger("reloadGrid"); //重新载入  
        }
        
        
        
    </script>
</body>
</html>